import { ComponentMetadata, Snippet } from '@alilc/lowcode-types';

const PointSummaryMeta: ComponentMetadata = {
  componentName: 'PointSummary',
  title: '点位汇总',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  group: '设施环境',
  category: '统计展示',
  priority: 0,
  npm: {
    package: 'hzdz-charts',
    version: '0.1.0',
    exportName: 'PointSummary',
    main: 'src/index.tsx',
    destructuring: true,
    subName: '',
  },
  configure: {
    props: [
      {
        title: '基础配置',
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'title',
            title: '组件标题',
            setter: 'StringSetter',
            defaultValue: '点位汇总',
          },
          {
            name: 'englishTitle',
            title: '英文标题',
            setter: 'StringSetter',
            defaultValue: 'Point summary',
          },
        ],
      },
      {
        title: '数据配置',
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'firstRowData',
            title: '第一行数据',
            setter: {
              componentName: 'ArraySetter',
              props: {
                itemSetter: {
                  componentName: 'ObjectSetter',
                  props: {
                    config: {
                      items: [
                        {
                          name: 'label',
                          title: '名称',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'value',
                          title: '数值',
                          setter: 'NumberSetter',
                        },
                        {
                          name: 'icon',
                          title: '图标',
                          setter: 'StringSetter',
                        },
                      ],
                    },
                  },
                },
              },
            },
            defaultValue: [
              { label: '消防重点区域', value: 20, icon: 'http://localhost:8085/static/images/消防重点区域.png' },
              { label: '服务点位', value: 20, icon: 'http://localhost:8085/static/images/服务点位.png' },
              { label: '易积水点', value: 15, icon: 'http://localhost:8085/static/images/易积水点.png' },
              { label: '平安哨', value: 20, icon: 'http://localhost:8085/static/images/平安哨.png' },
            ],
          },
          {
            name: 'secondRowData',
            title: '第二行数据',
            setter: {
              componentName: 'ArraySetter',
              props: {
                itemSetter: {
                  componentName: 'ObjectSetter',
                  props: {
                    config: {
                      items: [
                        {
                          name: 'label',
                          title: '名称',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'value',
                          title: '数值',
                          setter: 'NumberSetter',
                        },
                        {
                          name: 'icon',
                          title: '图标',
                          setter: 'StringSetter',
                        },
                      ],
                    },
                  },
                },
              },
            },
            defaultValue: [
              { label: '消杀点', value: 99, icon: 'http://localhost:8085/static/images/消杀点.png' },
              { label: '易滑倒点位', value: 36, icon: 'http://localhost:8085/static/images/易滑倒点位.png' },
              { label: '易受风点', value: 2, icon: 'http://localhost:8085/static/images/易受风点.png' },
              { label: '地下出入口', value: 99, icon: 'http://localhost:8085/static/images/地下出入口.png' },
            ],
          },
        ],
      },
      {
        title: '事件处理',
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'onClick',
            title: '点击事件',
            setter: 'FunctionSetter',
          },
          {
            name: 'onItemClick',
            title: '点击项事件',
            setter: 'FunctionSetter',
          },
        ],
      },
      {
        title: '外观',
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'style',
            title: '自定义样式',
            setter: 'StyleSetter',
          },
          {
            name: 'className',
            title: '自定义类名',
            setter: 'StringSetter',
          },
        ],
      },
    ],
    supports: {
      style: true,
      events: ['onClick', 'onItemClick'],
    },
    component: {},
  },
};

const snippets: Snippet[] = [
  {
    title: '点位汇总',
    screenshot: '',
    schema: {
      componentName: 'PointSummary',
      props: {
        title: '点位汇总',
        englishTitle: 'Point summary',
        firstRowData: [
          { label: '消防重点区域', value: 20, icon: 'http://localhost:8085/static/images/消防重点区域.png' },
          { label: '服务点位', value: 20, icon: 'http://localhost:8085/static/images/服务点位.png' },
          { label: '易积水点', value: 15, icon: 'http://localhost:8085/static/images/易积水点.png' },
          { label: '平安哨', value: 20, icon: 'http://localhost:8085/static/images/平安哨.png' },
        ],
        secondRowData: [
          { label: '消杀点', value: 99, icon: 'http://localhost:8085/static/images/消杀点.png' },
          { label: '易滑倒点位', value: 36, icon: 'http://localhost:8085/static/images/易滑倒点位.png' },
          { label: '易受风点', value: 2, icon: 'http://localhost:8085/static/images/易受风点.png' },
          { label: '地下出入口', value: 99, icon: 'http://localhost:8085/static/images/地下出入口.png' },
        ],
      },
    },
  },
];

export default {
  ...PointSummaryMeta,
  snippets,
};